
// PatchClusterDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "Data/CodeBook.h"
#include "Controls\PicEditor.h"

// CPatchClusterDlg dialog
class CPatchClusterDlg : public CDialog
{
	CImageList	m_imlRepresentative,
				m_imlCodeBook;
	CCodeBook*	m_codeBook;
	CFileFind	m_fileFinder;
	BOOL		m_bFindingFile;
	CString		m_sFileFindPath;
	CArray<CPatchSample*>	m_arrFeatures;

	CString BrowseFolder(CString strTitle);
	void RenderCodeBook();
	void EmptyImgList(CImageList& imgList);
	BOOL LoadImageToEditor(CString& path);
	void ProcessImageRegion();

// Implementation
protected:
	HICON m_hIcon;

	DECLARE_MESSAGE_MAP()

	// Generated message map functions
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();

// Construction
public:
	// Dialog Data
	enum { IDD = IDD_PATCHCLUSTER_DIALOG };
	
	CPatchClusterDlg(CWnd* pParent = NULL);	// standard constructor
	virtual ~CPatchClusterDlg();

	CComboBox m_cmbFeature;
	CEdit m_txtImgFolder;
	CEdit m_txtClusterCount;
	CSpinButtonCtrl m_spinClusterCount;
	CEdit m_txtIterationCount;
	CSpinButtonCtrl m_spinIterationCount;
	CEdit m_txtEpsilon;
	CListCtrl m_lstRepresentative;
	CListCtrl m_lstCodeBook;
	CEdit m_txtXmlFile;
	CButton m_btnXmlFile;
	CEdit m_txtCodeBookPath;
	CSpinButtonCtrl m_spinPatchSize;
	CEdit m_txtPatchSize;
	CPicEditor m_picFrame;
	CButton m_btnStartFeature;
	CButton m_btnClearHotRegion;
	CButton m_btnLoadSamples;
	CButton m_btnSaveSamples;

	afx_msg void OnBnClickedBtnbrowsefolder();
	afx_msg void OnBnClickedOk();
	afx_msg void OnLvnItemActivateLstrepresantative(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedBtnbrowsexmlfile();
	afx_msg void OnBnClickedBtnbrowseoutputfolder();
	afx_msg void OnBnClickedBtnapprove();
	afx_msg void OnBnClickedBtnclear();
	afx_msg void OnBnClickedBtnstartcluster();
	afx_msg void OnBnClickedBtnloadsamples();
	afx_msg void OnBnClickedBtnsavesample();
};
